import time
from .card import Card
from .user import User
class Log():
    def __init__(self,userobj):
        self.t=time.strftime('%Y/%m/%d %H:%M:%S')
        self.name=userobj.username
    def log_save(self,record):
        with open(f'./databases/{self.name}.txt','a') as fp:
           fp.write(record+'\n')
    def sav_m(self,userobj,money):
        record=f'[{self.t}] 用户{userobj.username} 存入{money}元'
        self.log_save(record)
    def get_m(self,userobj,money):
        record=f'[{self.t}] 用户{userobj.username} 取出{money}元'
        self.log_save(record)
    def trans_m(self,userobj,reuserobj,money):
        record=f'[{self.t}] 用户{userobj.username} 向 {reuserobj.username} 转出{money}元'
        self.log_save(record)






